import { categoryListApi, categoryAddListApi } from '@/api/product.js'
export default {
    state: {
        categoryListDatas: {},
        AddCategoryListDatas: []
    },
    mutations: {
        changeCategoryListDatas(state, data) {
            state.categoryListDatas = data;
        },
        changeAddCategoryListDatas(state, data) {
            state.AddCategoryListDatas = data;
        }
    },
    actions: {
        async actChangeCategoryListDatas(context, data) {
            var rel = await categoryListApi(data);
            if (rel) {
                context.commit('changeCategoryListDatas', rel.data)
            }

        },
        async actAddChangeCategoryListDatas(context, data) {
            var rel = await categoryAddListApi(data);
            console.log(rel);
            if (rel) {
                context.commit('changeAddCategoryListDatas', rel.data.data)
            }

        }
    }
}